package com.shipwe.loans.utils.shared


/**
 * Shipwe
 * @Author wwdeng
 * @CreateTime: 2024/11/8 10:59
 * @Annotation：SharedPreferences 数据存取帮助类
 */
object ShipweSharedHelper {

    /**
     * 保存数据
     */
    fun putShipweSharedData(key: String, value: Any){
        ShipweSharedUtils.put(key,value)
    }

    /**
     * 获取String
     */
    fun getShipweSharedString(key: String): String{
        return ShipweSharedUtils.getString(key)
    }

    /**
     * 获取boolean
     */
    fun getShipweSharedBoolean(key: String): Boolean{
        return ShipweSharedUtils.getBoolean(key,false)
    }

    /**
     * 获取Int
     */
    fun getShipweSharedInt(key: String): Int{
        return ShipweSharedUtils.getInt(key,0)
    }


    /**
     * 移除指定内容
     */
    fun removeShipweSharedData(key: String){
        ShipweSharedUtils.remove(key)
    }

    /**
     * 退出登录，移除用户信息
     */
    fun onShipweUserLoginOut(){
        //移除已登录状态
        removeShipweSharedData(ShipweSharedKey.SHIPWE_LOGIN)
        //移除用户Token
        removeShipweSharedData(ShipweSharedKey.SHIPWE_TOKEN)
        //移除用户id
        removeShipweSharedData(ShipweSharedKey.SHIPWE_USERID)
        removeShipweSharedData(ShipweSharedKey.SHIPWE_MOBILE)
        removeShipweSharedData(ShipweSharedKey.SHIPWE_IS_ADSOURCE)
        removeShipweSharedData(ShipweSharedKey.SHIPWE_PROCESS)
        removeShipweSharedData(ShipweSharedKey.SHIPWE_CUSTOM_DATA)
        removeShipweSharedData(ShipweSharedKey.SHIPWE_TANZANIA_LANGUAGE)
    }
}